package entity

import (
	"time"

	"github.com/jinzhu/gorm"
	"shqsoft.cn/pasnj/base"
)

//BasePara FTP曲线
type BaseZtwh struct {
	ID        int     `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	PANMTHREE float64 `gorm:"column:PANMTHREE"`
	PANMSIX   float64 `gorm:"column:PANMSIX"`
	PANMNINE  float64 `gorm:"column:PANMNINE"`
	PANMYEAR  float64 `gorm:"column:PANMYEAR"`

	PANMONE float64 `gorm:"column:PANMONE"`
	PANMTWO float64 `gorm:"column:PANMTWO"`
	PANFour float64 `gorm:"column:PANFour"`

	PAVL float64    `gorm:"column:PAVL"`
	BGDT *time.Time `gorm:"column:BGDT;type:date;"`

	PANM5  float64 `gorm:"column:PANM5"`
	PANM7  float64 `gorm:"column:PANM7"`
	PANM8  float64 `gorm:"column:PANM8"`
	PANM10 float64 `gorm:"column:PANM10"`
	PANM11 float64 `gorm:"column:PANM11"`
}

//TableName FTP曲线表名
func (BaseZtwh) TableName() string {
	return "T_BASE_PARA_DR"
}

// // 导入后执行分户处理
func BaseZtwhDtipAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	err = tx.Exec("EXEC UP_BASE_PARA_ZTWH").Error
	if err != nil {
		return err
	}
	return nil
}

//BaseZtwhEF 一个结构
func BaseZtwhEF() base.EntityFunc {
	return func() interface{} {
		entity := BaseZtwh{}
		return &entity
	}
}

//BaseZtwhESF 数组结构体
func BaseZtwhESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []BaseZtwh
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("BaseZtwh", base.NewDefaultDao(BaseZtwhEF(), BaseZtwhESF(), nil))
	base.SetAfterCallBack("BaseZtwh", BaseZtwhDtipAfterImport)
}
